<template>
    <div class="exam-container">
        <top-bar></top-bar>
        <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getData">
            <exam-list :list="list"></exam-list>
        </van-list>
    </div>
</template>
<script>
import ExamList from "components/ExamList";
export default {
    name: "exam",
    components: {
        ExamList,
    },
    data() {
        return {
            loading: false,
            finished: false,
            pageNo: 0,
            list: [],
        };
    },
    mounted() {},
    methods: {
        getData() {
            // this.$APIs.getExamScore();

            this.$APIs.getExam({ pageNo: this.pageNo + 1, pageSize: 10 }).then(data => {
                if (data.data.length) {
                    this.pageNo += 1;
                    this.list.push(...data.data);
                    this.loading = false;
                } else {
                    this.finished = true;
                    this.loading = false;
                }
            });
        },
    },
};
</script>

<style lang="scss" scoped>
.exam-container{
    height: 100%;
    display: flex;
    flex-direction: column;
    .van-list {
        flex: 1;
        overflow: scroll;
    }
}
</style>
